# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-spx
_extname=spx
pkgver=0.4.14
pkgrel=0
pkgdesc="A simple & straight-to-the-point PHP 8.1 profiling extension with its built-in web UI"
url="https://github.com/NoiseByNorthwest/php-spx"
arch="x86_64 aarch64"
license="GPL-3.0-or-later"
_phpv=81
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev zlib-dev"
source="php-$_extname-$pkgver.tar.gz::https://github.com/NoiseByNorthwest/php-spx/archive/v$pkgver.tar.gz
	fix-test.patch::https://github.com/NoiseByNorthwest/php-spx/pull/221/commits/40aef99afc3359c51ac5327bc1881a80128fefda.patch"
builddir="$srcdir/php-$_extname-$pkgver"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
	$_php -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
faece20b8404a456c17a50679cf6fb1d41553788471eccbceba4f1271b9b58a297eda3431894f4127ad686f0cb12671685f68aaba8279b42147cc72958e9b215  php-spx-0.4.14.tar.gz
e9850e9571b0002d64c42fc2e38678f80680c559b1ecc16c1c497ae143b522011cba7c0bc9e73f7f6c8e3e2c81f301216206d8cb1e42bb3cd8b36d2f2d1b2bbb  fix-test.patch
"
